<%@ page language="java" import="java.util.*,com.sirenbang.easyshop.config.*" pageEncoding="utf-8"%>
<%@ include  file="//jsps/front/common/taglibs.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>登录</title>    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<script type="text/javascript" src="<c:url value="/js/prototype.js"/>"></script>
    <link rel="stylesheet" type="text/css" href="<c:url value="/jsps/front/css/application.css"/>">
    <link rel="stylesheet" type="text/css" href="<c:url value="/jsps/front/css/shop_login.css"/>">

	<script type="text/javascript">
	  function check(){
	    if(checkCode()==false || txtNickName_check()==false || txtPassword_check()==false)
	        return false;
	    return true;
	  }
	  
	  function $(id){
        	return document.getElementById(id);
        };
        function $F(id){
	        var o=$(id);
	        return o.value;
        };
	  
	  function check_nickname_focus(){
		    alert("昵称可由大小写英文字母、中文、数字组成，长度2-10个汉字或4-20个字符。");
		}
        function txtNickName_check(){
		    var nickname = $F('name');
            /*alert(nickname.charCodeAt(0));*/
            var length=nickname.length;
            for(var i=0;i<length;i++){
            	if(nickname.charCodeAt(i)>127 || nickname.charCodeAt(i)==94){
            	    length+=1;
            	   /*alert(length);*/
            	}           	
            }
		    if(nickname=='')
		    {
		       alert("此项必填!");
		        return false;
		    }
		    /*alert(isNaN(nickname)==false);*/
		    if(length<3||length>15 ||isNaN(nickname)==false){
		       alert("昵称可由大小写英文字母、数字组成，长度为3-15");   
		        return false;
		    }
		    return true;
		}
		
		/*设置密码*/
		function check_password_focus(){
		
		}
		function txtPassword_check(){
		    var password = $F('cusPwd');		    
		    if(password=='')
		    {
  				alert("此项必填!");
		        return false;
		    }
		    
		    if(password.length<3||password.length>15){
				alert("长度为3-15");
		        return false;    
		    }    
		    return true;		    
		}
		//检验验证码
		function checkCode(){
        //http://localhost:8080/code/genCC?act=checkCode&cc=3h3t
	        new Ajax.Request(
	            encodeURI("genCC?act=checkCode&seed="+Math.random()+"&cc="+$('cc').value),
	            {
	              method:'post',
	              onComplete:function(xhr){
	                 var result=xhr.responseText;
                    if(result=='ok'){
	                   $('checkResult').innerText=' ';
	                   $('checkResult').className='rightCC';
	                   
	                   return true;
	                 }
	                 else
	                 {
	                   $('checkResult').innerText='验证码错误!';
	                   $('checkResult').className='errCC';
	                   return false;                
	                 }
	              }
	            }
	        );
    }
    function reloadVerifyCode(){  
           var timenow = new Date().getTime();                            
           document.getElementById("checkcode").src="<%=request.getContextPath()%>/genCC?act=generate&d="+timenow;  
    }  
	</script>

  </head >
  <body onload="reloadVerifyCode();">       
         <DIV class=right_cont>
             <IMG title=logo src="<c:url value="/jsps/front/images/login/06.GIF"/>">
            <P class=login_help>登录帮助</P>
            <DIV class=login_frame>
                 <H2>请登录</H2>
                 <form action="<c:url value="/securityMgr?act=login"/>" method="post">
						<UL class=ul_login>
							<LI class=top_li id=topli></LI>
							<LI class=notice_li id=liDivErrorMessage>
								<DIV class=notice id=divErrorMssage>${loginErr}</DIV>
								<DIV class=empty_right></DIV>
							</LI>
							<LI>
								<SPAN class=span_li>
								   <SPAN class=span_n>
								      <SPAN class=text_f>地址或昵称：</SPAN>
								   </SPAN>
								   <INPUT class=input_text id=txtUsername
										onblur="this.className='input_text';txtNickName_check();"
										onfocus="this.className='input_text input_text_over';"
										maxLength=40 name=name value="${param.userName}">
							    </SPAN>
							</LI>
							<LI>
								<SPAN class=span_li><SPAN class=span_n>密码：</SPAN>
								<INPUT class=input_text id=txtPassword
										onkeydown=txtPassword_keyDown(event)
										onblur="this.className='input_text';txtPassword_check();"
										onfocus="this.className='input_text input_text_over';"
										type=password maxLength=20 name=cusPwd> </SPAN>
										<P id=Msg style="font-size:13px;"></P>
							</LI>
							<LI>
							    <img id="checkcode" src="/genCC?act=generate"/><br/>
									    <a href="javascript:reloadVerifyCode();">换一张</a>
									    <br/>
									    输入验证码: <input type="text" id="cc" name=cc
									                     style="width:80px;height:20px"
									                     onblur="this.className='input_text';checkCode();"
														 onfocus="this.className='input_text input_text_over';"/>
									   		 <span id="checkResult"></span>
							</LI>
							<LI>
								<SPAN class=span_li>
								    <INPUT class=butt_login id=btnSignCheck
										onMouseOver="this.className='butt_login butt_login_over'"
										onclick="if(check())document.forms[0].submit();"
										onMouseOut="this.className='butt_login'" 
										type=button name=btn_login> 
										<INPUT id=btnSign style="DISPLAY: none" type="submit" name=btnSign> 
										<SPAN class=span_n><A href="#">忘记密码？</A></SPAN>
								 </SPAN>
							</LI>
							
						</UL>
			    </form>
				<DIV class=new_login>
				  <SPAN  class=font_w>还没有注册吗?</SPAN>　快捷方便的免费注册，让你立刻尽享各项优惠及服务... 
				  <INPUT class=login_new onMouseOver="this.className='login_new login_new_over'" onClick="location.href='<c:url value="/jsps/front/customer/register_customer.jsp"/>'" onMouseOut="this.className='login_new'" type=button name=btn_enterregister> 
				</DIV>			    
            </DIV>
         </DIV> 
        <div style="clear:both;"></div>
        
  <div id="footer" style="bottom:0px; margin-top:10px;width:960px;border-top:1px solid; COLOR: #404040;COLOR: #666; text-align:center; background-color:#fff;font-size:12px;">
	        <%=VersionInfo.buildFooterStr()%>           
	        </div>
    
    <c:if test="${not empty err}">
	    <script type="text/javascript">
	       alert('${err}');
	    </script>
    </c:if>
     <c:if test="${not empty loginMsg}">
	    <script type="text/javascript">
	       alert('${loginMsg}');
	    </script>
    </c:if>
  </body>
</html>
